var express=require('express');
var router=express.Router();
const {getSalespersons,getSalespersonsById, updateSalespersons, deleteSalespersons, addSalespersons, searchPersonal}=require('../service/salespersonsService');

router.get('/getSalespersons',async function(req,res,next){
  const personal =await getSalespersons(req.query);
  console.log('one',req.query);
  res.send(personal)
});

router.post('/getSalespersonsById',async function(req,res,next){
  const data= await getSalespersonsById(req.body);
  res.send(data)
})
router.post('/updateSalespersons',async function(req,res,next){
  const data =await updateSalespersons(req.body);
  res.send(data)
})
router.post('/deleteSalespersons',async function(req,res,next){
  const data=await deleteSalespersons(req.body);
  res.send(data)
})
router.post('/addSalespersons',async function(req,res,next){
  const data =await addSalespersons(req.body);
  res.send(data)
})
module.exports = router;